feat: implement backend configuration and lifecycle management#488
Merged
niteshpurohit merged 19 commits intomainfrom May 5, 2026
Merged
Conversation
- Added `configure_backend` method to set backend class and options. - Introduced `BackendBoot` class to manage backend lifecycle hooks. - Updated CLI to utilize the configured backend during worker execution. - Enhanced tests to validate backend configuration and lifecycle behavior. - Updated documentation to reflect changes in backend configuration usage. closes: #110
There was a problem hiding this comment.
Pull request overview
This PR wires a new backend-configuration path into Karya’s runtime, adding backend boot/lifecycle handling so the CLI can resolve a configured backend into a queue store and wrap worker execution with backend hooks.
Changes:
- Add
Karya.configure_backend+ accessors for backend class/options. - Introduce
Karya::CLI::BackendBootto resolve/instantiate backends, build queue stores, and run lifecycle hooks. - Update CLI worker boot + specs + docs to use backend configuration.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/pages/runtime/workers.md | Updates worker example to configure a backend instead of a queue store. |
| docs/pages/getting-started.md | Tweaks guidance to mention configuring a backend class at boot. |
| docs/pages/backends.md | Updates “scenario” snippets to show backend selection values. |
| core/karya/spec/karya/karya_base_spec.rb | Adds unit specs for Karya.configure_backend storage/defensive copying. |
| core/karya/spec/karya/cli_start_spec.rb | Extends CLI worker boot specs to validate backend resolution and failure modes. |
| core/karya/spec/karya/cli_backend_boot_spec.rb | Adds lifecycle-hook behavior specs for BackendBoot.run_with_lifecycle. |
| core/karya/sig/karya/base.rbs | Adds signatures for backend configuration methods and state. |
| core/karya/sig/karya/backend.rbs | Introduces _BackendClass interface for backend class typing. |
| core/karya/sig/karya.rbs | Adds backend_option_value alias and extends option typing. |
| core/karya/lib/karya/cli/backend_boot.rb | Implements backend resolution/instantiation and lifecycle wrapping. |
| core/karya/lib/karya/cli.rb | Wires BackendBoot into karya worker execution path. |
| core/karya/lib/karya/base.rb | Implements configure_backend, backend_class, and backend_options. |
- Added validation to reject queue_store_class when it is an instance of a queue store. - Updated the error handling to raise InvalidBackendConfigurationError for unsupported values. - Improved the generic_backend_option? method to ensure queue_store_class is not treated as a callable option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
configure_backendmethod to set backend class and options.BackendBootclass to manage backend lifecycle hooks.closes: #110